package com.zc.controller.newController;

import com.zc.dto.PageDto;
import com.zc.dto.ResultDto;
import com.zc.entity.TwoProduce;
import com.zc.service.two.TwoProduceService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.naming.ldap.PagedResultsControl;
import java.util.List;

@CrossOrigin
@Controller
@RequestMapping("/two/produce")
public class TwoProduceController extends BaseController{
    @Resource
    private TwoProduceService biz;

    @ResponseBody
    @RequestMapping(value="/findAll",method = RequestMethod.POST)
    public ResultDto<PageDto> findAll(Integer pageNow,Integer pageSize){
        ResultDto<PageDto> result = new ResultDto<>();
        try {
            List<TwoProduce> list = biz.findAll(result,pageNow,pageSize);
            result.setResultData(true,0,"查询成功",list);
        } catch (Exception e) {
            LOG.error("Two findall error:: ,{}",e);
            result.setResultData(false,1,"拉取产品信息失败",null);
        }
        return result;
    }
//    @ResponseBody
//    @RequestMapping("/count")
//    public ResultDto<Double> count(String numList,int type){
//        ResultDto<Double> result = new ResultDto<>();
//        result.setData(biz.count(numList,type));
//        result.setSuccess(true);
//        result.setMessage("计算成功");
//        return result;
//    }
}
